home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 1 / ACE CD 1.iso / files / utils / musicx21.dms / in.adf / rexx / CopyTranspose.mxe next >
Encoding:
Text File  |  1993-10-05  |  1.5 KB  |  51 lines

  1. /*    RexxEdit example ARexx macro program                    */
  2.  
  3. /*    Copy and/or transpose notes with rechannalizing            */
  4.  
  5. options results                            /* always include this command    */
  6.  
  7. MxMIRROR "Transposition:,64"            /* -64 to 64 slider                */
  8.  
  9. MXSLIDER "New Channel:,1,16,1"            /* 1 to 16 slider                */
  10.  
  11. MXRADIO "Selected Notes,All Notes"        /* mutually exclusive options    */
  12.  
  13. MXBUTTON "Delete Original Notes"            /* an option                    */
  14.  
  15. MXREQUEST "COPY & TRANSPOSE NOTES,DO IT"  /* put up requester and wait    */
  16. if result == 0 then exit                        /* 0 if user hit CANCEL */
  17.  
  18. MXPOINTER "sleepy"                        /* indicate we're working on it    */
  19.  
  20. MXVALUE 1                                /* get delta note value            */
  21. noteval = result
  22.  
  23. MXVALUE 2                                /* get channel number (0-15)    */
  24. chan = result - 1
  25.  
  26. MXVALUE 4                                /* did they want to replace it?    */
  27. replace = result
  28.  
  29. MXVALUE 3                                /* selected or all events        */
  30. if result == 0 then BEGINSCAN 'selected'
  31. else BEGINSCAN 'all'                    /* begin event scan                */
  32.  
  33. if result ~= 0 then do forever            /* if BEGINSCAN worked, scan    */
  34.  
  35.   NEXTEVENT                                /* get next event                */
  36.   if result == 0 then break
  37.  
  38.   if EVENT.TYPE == 'NOTE' then do        /* if a NOTE, modify it            */
  39.     newval = EVENT.NUM + noteval
  40.     if newval < 0 then newval = newval + 128
  41.     if newval > 127 then newval = newval - 128
  42.     EVENT.NUM = newval
  43.     EVENT.CHANNEL = chan
  44.     if replace == 1 then REPLEVENT        /* either replace or add event    */
  45.     else ADDEVENT
  46.   end
  47. end
  48. ENDSCAN                                    /* terminate scan                */
  49.  
  50. MXPOINTER "normal"                        /* we're all done                */
  51.